home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Apple Color OneScanner SDK / Scan Image 1.0 / ScIntf.h < prev   
Encoding:
C/C++ Source or Header  |  1996-08-24  |  10.1 KB  |  309 lines  |  [TEXT/MPS ]

  1. /*================================================================================     */
  2. /*     ScIntf.c - C Interface declaration to the Scanner Driver Interface Library         */
  3. /*                                                                                    */
  4. /*    Written by  Tad Browne, PSAP        Created: 20-FEB-88                            */
  5. /*                                                                                    */
  6. /*    Copyright Apple Computer, 1988-1996                                                */
  7. /*_____________________________________________________________________________        */
  8. /*                                                                                    */
  9. /* Modification History:                                                              */
  10. /*                                                                                    */
  11. /*    15-OCT-89 -    Tad Browne                                                            *)
  12. /*    Added new definitions to support Apple 8-bit Scanner:                            */
  13. /*        1) Changed Reserved field of ScCompRec to startResolution and                 */
  14. /*            endResolution to support resolutions in 1 dpi increments                */
  15. /*        2) Changed downLoadFlags in scAdvFeaturesRec to downLoadStart,                */
  16. /*            downLoadEnd, and downLoadFlags to support download patterns                */
  17. /*            other than square, and sizes up to 127 X 127;                            */
  18. /*    02-APR-90 -    Tad Browne                                                            *)
  19. /*        Added new advanced feature: ScSetFastMode (Fast Scan Mode)                    */
  20. /*    03-APR-90 -    Tad Browne                                                            *)
  21. /*        Added new advanced feature: ScVendorUnique (Carriage Position)                */
  22. /*    14-OCT-90 -    Tad Browne                                                            *)
  23. /*        Added ScSetLed, ScResetButton, ScGetButton, ScSetNoCal calls                */
  24. /*    12-NOV-90 -    Tad Browne                                                            *)
  25. /*        Changed ScSetFastMode to ScSetSpeed, added new constants for ScSetSpeed        */
  26. /*        Added constants for Vendor Unique Parameter Types                            */
  27. /*    VERSION 2.0a11 (for driver version 2.0a11-12)                                    */
  28. /*    24-APR-1991 - Bill Houston                                                        */
  29. /*        fixed advanced constants, added version reference to driver                    */
  30. /*    VERSION 2.0a13 (for driver version 2.0a13)                                        */
  31. /*    9-MAY-1991 - Bill Houston                                                        */
  32. /*        changed a char to Boolean in ScGetButton                                    */
  33. /*    9-Dec-91 - Steve Bischoff                                                        */
  34. /*        Added scFullColor,scBiLevelColor                                            */
  35. /*    24/5/95 - John Wang                                                                */
  36. /*        Added vendor unique calls and structures for Scanner 4.0 driver.            */
  37. /*    19/6/96 - John Wang                                                                */
  38. /*        Added error code for paper jam.                                                */
  39. /*                                                                                    */
  40. /*==============================================================================    */
  41.  
  42.  
  43. /* Standard Constants */
  44.  
  45. #define        scLineArt     0        /* Line Art Composition */
  46. #define        scHalfTone    1        /* HalfTone Composition */
  47. #define        scGrayScale    2        /* Gray Scale Composition */
  48. #define        scBiLevelColor 3    /* BiLevel RGB Color Composition */
  49. #define        scFullColor 4        /* Full Color Composition */
  50.  
  51.  
  52. /* Standard Data Types */
  53.  
  54. typedef struct {
  55.                 unsigned char     brightnessRange;    /* NEW 2.0 */
  56.                 unsigned char     contrastRange;        /* NEW 2.0 */
  57.                 unsigned char     reserved;            /* NEW 2.0 */
  58.                 unsigned char     resFlags;            /* NEW 2.0 */
  59.                 short    resElements;
  60.                 short    halfToneElements;
  61.                 short    brightnessMax;
  62.                 short    contrastMax;
  63.                 long    bitsPerPixel;
  64.                 short    minReadSize;
  65.             } ScCompRec;
  66.  
  67. typedef struct {
  68.                 ResType scannerType;
  69.                 short    version;
  70.                 short    scanWidthNum;
  71.                 short    scanWidthDen;
  72.                 short    scanLengthNum;
  73.                 short    scanLengthDen;
  74.                 ScCompRec composition[scFullColor+1];
  75.             } ScStdFeaturesRec;
  76.  
  77. typedef ScStdFeaturesRec *ScStdFeaturesPtr ;
  78.  
  79. typedef short ScResArray[1];
  80. typedef ScResArray *ScResPtr;
  81.  
  82. typedef unsigned char String31[32];
  83. typedef String31 ScHalfToneArray[1];
  84. typedef ScHalfToneArray *ScHalfTonePtr;
  85.  
  86.  
  87. typedef struct {
  88.                 long    reserved;
  89.                 short    xDpi;
  90.                 short    yDpi;
  91.                 Rect    scanRect;
  92.                 short    brightness;
  93.                 short    contrast;
  94.                 char    composition;
  95.                 char    bitsPerPixel;
  96.                 short    halfTone;
  97.             } ScAreaRec;
  98.  
  99. typedef struct {
  100.                 long        reserved;
  101.                 short        numAreas;
  102.                 ScAreaRec     scanAreas[1];
  103.             } ScScanAreaRec;
  104. typedef    ScScanAreaRec *ScScanAreaPtr;
  105.  
  106.  
  107. /* Standard Routines */
  108.  
  109.     extern pascal short ScOpen(short *refNum);
  110.     extern pascal short ScClose(short refNum);
  111.     extern pascal short ScGetStdFeatures(short refNum,
  112.                                 ScStdFeaturesPtr stdFeaturesPtr,
  113.                                 short length);
  114.     extern pascal short ScGetRes(short refNum, short compType,
  115.                                 ScResPtr resPtr);
  116.     extern pascal short ScGetHalfTones(short refNum, short compType, 
  117.                                 ScHalfTonePtr halfTonePtr);
  118.     extern pascal short ScSetScanArea(short refNum, 
  119.                                 ScScanAreaPtr scanAreaPtr);
  120.     extern pascal short ScDoScan(short refNum, char *buffer, 
  121.                                 long *count, short unused, 
  122.                                 short byteWidth, short rowBytes);
  123.     extern pascal short ScAbortScan(short refNum);
  124.  
  125.  
  126. /* Advanced Constants */
  127.  
  128. #define        scLightDetail     0    /* GrayMap 0 */
  129. #define        scNormalDetail    1    /* GrayMap 1 */
  130. #define        scDarkDetail     2    /* GrayMap 2 */
  131.  
  132. #define        scSpeedNormal    0    /* NORMAL Speed, slow with handshaking */
  133. #define        scSpeedHigh        1    /* HIGH Speed, fast with handshaking */
  134. #define        scSpeedFast        2    /* FAST Speed, fast without handshaking */
  135.  
  136. /* Apple (Vendor) Unique Param Type Constants */
  137.  
  138. #define        scUniqueUnpark    0    /* Unpark the the carriage */
  139. #define        scUniquePark    1    /* Park the the carriage */
  140. #define        scUniqueAbsPos    2    /* Abosolute carriage positioning */
  141. #define        scUniqueRelPos    3    /* Relative carriage positioning */
  142. #define        scUniqueSetID    4    /* Set Scanner Driver SCSI ID */
  143. #define        scUniqueSetCRAM    5    /* Set CRAM Data (always 2550 bytes) */
  144. #define        scUniqueGetCRAM    6    /* Get CRAM Data (always 2550 bytes) */
  145.  
  146. /* ***** Added 5/24/95 JW ***** */
  147. /* Apple (Vendor) Unique Param Type Constants supported by Scanner 4.0 driver */
  148. #define        scUniqueGetOutputFormat                100
  149. #define        scUniqueSetOutputFormat                101
  150. #define        scUniqueGetInterpolation            102
  151. #define        scUniqueSetInterpolation            103
  152. #define        scUniqueGetResolutionInfo            104
  153. #define        scUniqueGetTPUADFInfo                105
  154. #define        scUniqueGetADFStatus                200
  155. #define        scUniqueGetADFPriority                201
  156. #define        scUniqueSetADFPriority                202
  157. #define        scUniqueGetTPUStatus                300
  158. #define        scUniqueGetTPUMode                    301
  159. #define        scUniqueSetTPUMode                    302
  160. #define        scUniqueGetTPUMDC                    303
  161. #define        scUniqueSetTPUMDC                    304
  162. #define        scUniqueGetTPURatio                    305
  163. #define        scUniqueSetTPURatio                    306
  164. #define        scUniqueGetTPUNP                    307
  165. #define        scUniqueSetTPUNP                    308
  166. #define        scUniqueGetTPUFilmType                309
  167. #define        scUniqueSetTPUFilmType                310
  168.  
  169.  
  170. /* Advanced Data Types */
  171.  
  172.  
  173. typedef struct {
  174.                 long    reserved;
  175.                 short    version;
  176.                 short    secondaryMax;
  177.                 long    downLoadFlags;
  178.                 long    restrictFlags;
  179.                 long    controlFlags;
  180.             } ScAdvFeaturesRec;
  181. typedef    ScAdvFeaturesRec *ScAdvFeaturesPtr;
  182.  
  183. typedef struct {
  184.                 char xDimension;
  185.                 char yDimension;
  186.                 char patData[64];
  187.             } ScPatRec;
  188. typedef ScPatRec *ScPatPtr;
  189.  
  190. typedef struct {
  191.                 char RedGamma[256];
  192.                 char GreenGamma[256];
  193.                 char BlueGamma[256];
  194.             }ScGammaTableRec;
  195. typedef ScGammaTableRec  *ScGammaTablePtr;
  196.  
  197. typedef struct{
  198.                 short matrix[9];
  199.                 }ScMatrix;
  200.                 
  201. typedef ScMatrix *ScMatrixPtr;
  202.  
  203. /* ***** Added 5/24/95 JW ***** */
  204. /* This structure is used by the vendorunique call in Scanner 4.0 driver to
  205.     determine scanner resolution info. */
  206.     
  207. typedef struct {
  208.     short        basic_x;
  209.     short        basic_y;
  210.     short        max_x;
  211.     short        max_y;
  212.     short        max_x_interpolated;
  213.     short        max_y_interpolated;
  214.     short        min_x;
  215.     short        min_y;
  216.     short        step_x;
  217.     short        step_y;
  218. } ScResolutionInfo;
  219. typedef    ScResolutionInfo *ScResolutionInfoPtr;
  220.  
  221. typedef struct {
  222.     short    TPUScanWidthNum;
  223.     short    TPUScanWidthDen;
  224.     short    TPUScanLengthNum;
  225.     short    TPUScanLengthDen;
  226.     short    ADFScanWidthNum;
  227.     short    ADFScanWidthDen;
  228.     short    ADFScanLengthNum;
  229.     short    ADFScanLengthDen;
  230. } ScTPUADFInfo;
  231. typedef ScTPUADFInfo *ScTPUADFInfoPtr;
  232.  
  233. /* Advanced Feature Flags */
  234.  
  235. /* Download flags */
  236. #define sc2x2Matrix     0x00000001
  237. #define sc3x3Matrix     0x00000002
  238. #define sc4x4Matrix     0x00000004
  239. #define sc5x5Matrix     0x00000008
  240. #define sc6x6Matrix     0x00000010
  241. #define sc7x7Matrix     0x00000020
  242. #define sc8x8Matrix     0x00000040
  243.  
  244. /* Restrict flags */
  245. #define scDiffXandYDPI    0x00000001
  246. #define scSecondArea    0x00000002
  247. #define scDiffXandYHT    0x00000004 
  248.  
  249. /* Control flags */
  250. #define scSetGroup3     0x00000001
  251. #define scSetGamma         0x00000002
  252. #define scSetThreshold     0x00000004
  253. #define scSetLampOn        0x00000008
  254. #define scSetNoHome        0x00000010
  255. #define scSetWait        0x00000020
  256. #define scSetSpeed        0x00000040
  257. #define scSetLed        0x00000080
  258. #define scGetButton        0x00000100
  259. #define scSetNoCal        0x00000200
  260. #define scLoadGamma        0x00000400
  261. #define scMatrixMul        0x00000800
  262. #define scInvert        0x00001000
  263. #define scSetAtoD        0x00002000
  264. #define scSensorSelect    0x00004000
  265.  
  266. #define scAllSensors    0x00
  267. #define scRedSensor        0x01
  268. #define scGreenSensor    0x02
  269. #define scBlueSensor    0x03
  270.  
  271. /* Advanced Routines  */
  272.  
  273.     extern pascal short ScGetAdvFeatures(short refNum,
  274.                      ScAdvFeaturesPtr advFeaturesPtr,
  275.                      short length);
  276.     extern pascal short ScSetHTPattern(short refNum, ScPatPtr patPtr);
  277.     extern pascal short ScSetGroup3(short refNum, char compressOn);
  278.     extern pascal short ScSetNoHome(short refNum, char noHome);
  279.     extern pascal short ScSetLamp(short refNum, char lampOn);
  280.     extern pascal short ScSetGrayMap(short refNum, short grayMap);
  281.     extern pascal short ScSetThreshold(short refNum, short thesholdLevel);
  282.     extern pascal short ScSetWaitButton(short refNum, char waitButton);
  283.     extern pascal short ScSetSpeed(short refNum, short speed);
  284.     extern pascal short ScSetLed(short refNum, char ledOn);
  285.     extern pascal short ScResetButton(short refNum, char setTrue);
  286.     extern pascal short ScGetButton(short refNum, Boolean *button);
  287.     extern pascal short ScSetNoCal(short refNum, char noCalMode);
  288.     extern pascal short ScVendorUnique(short refNum, short paramType, char *paramPtr);
  289.     extern pascal short ScInvertPixels(short refNum, Boolean invert);
  290.     extern pascal short ScSensorSelect(short refNum, short sensor);
  291.     extern pascal short ScSetScannerAtoD(short refNum, char Vrt,char Vrb);
  292.     extern pascal short ScLoadGamma(short refNum, ScGammaTablePtr gammaPtr);
  293.     extern pascal short ScLoadMatrix(short refNum, ScMatrixPtr matrixPtr);
  294.  
  295.  
  296. /* Error Codes for Scanner */
  297.  
  298.  
  299. #define    scNotFoundErr    -17064        /* Scanner Not Found */
  300. #define    scComErr        -17065        /* Communication Error */
  301. #define    scResetErr        -17066        /* Scanner Reset */
  302. #define    scParamErr        -17067        /* Parameter or Command Error */
  303. #define    scScannerErr    -17068        /* Internal Scanner Malfunction */
  304. #define    scLampErr        -17069        /* Lamp malfunction */
  305. #define    scEOS            -17070        /* End Of Scan */
  306. #define scDimLampErr    -17071        /* Lamp Getting Dim */
  307. #define scBusy            -17072        /* Scanner Already scanning */
  308. /* ***** Added 6/19/96 JW ***** */
  309. #define scPaperJam        -17073        /* Scanner Paper Jam */